package game

import (
	"server/game/internal"
	"server/msg"

	"server/pkg/github.com/name5566/leaf/gate"

	"google.golang.org/protobuf/proto"
)

func ReqPlayerBaseInfofunction(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerBaseInfo{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerBaseData") == nil {
		data := &PlayerBaseData{PlayerData: NewPlayerData("PlayerBaseData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerBaseData"] = data
			player.playerdataIF["PlayerBaseData"] = data
		}
	}
	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ResPlayerBaseInfo(player)
}

func ReqRemoveAdFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ReqRemoveAd(buf)
}

func UpdateBaseItemInfofunction(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.UpdateBaseItemInfo{}
	proto.Unmarshal(buf, detail)

	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).UpdateBaseItemInfo(detail)
}

func UpdateKeyValueDatafunction(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.UpdateKeyValueData{}
	proto.Unmarshal(buf, detail)

	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).UpdateKeyValueData(detail)
}

func ReqPlayerEmitUnlockDatafunction(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerEmitUnlockData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerEmitUnlockData") == nil {
		data := &PlayerEmitUnlockData{PlayerData: NewPlayerData("PlayerEmitUnlockData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerEmitUnlockData"] = data
			player.playerdataIF["PlayerEmitUnlockData"] = data
		}
	}
	player.GetIFGameData("PlayerEmitUnlockData").(*PlayerEmitUnlockData).ResPlayerEmitUnlockData(player)
}

func UpdatePlayerEmitUnlockDatafunction(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitUnlockData")
	data.(*PlayerEmitUnlockData).UpdatePlayerEmitUnlockData(buf)

}

func ReqPlayerPackDataFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerPackData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerEmitPackData") == nil {
		data := &PlayerEmitPackData{PlayerData: NewPlayerData("PlayerEmitPackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerEmitPackData"] = data
			player.playerdataIF["PlayerEmitPackData"] = data
		}
	}
	player.GetIFGameData("PlayerEmitPackData").(*PlayerEmitPackData).ResPlayerPackData(player)
}

func UpdatePlayerPackDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitPackData")
	data.(*PlayerEmitPackData).UpdatePlayerPackData(buf)

}

func ReqPlayerChessDataFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerChessData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerChessData") == nil {
		data := &PlayerChessData{PlayerData: NewPlayerData("PlayerChessData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerChessData"] = data
			player.playerdataIF["PlayerChessData"] = data
		}
	}
	player.GetIFGameData("PlayerChessData").(*PlayerChessData).ResPlayerChessData(player)
}

func UpdatePlayerChessDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerChessData")
	data.(*PlayerChessData).UpdatePlayerChessData(buf)

}

func ResChessColorDataFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqChessColorData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerChessData") == nil {
		data := &PlayerChessData{PlayerData: NewPlayerData("PlayerChessData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerChessData"] = data
			player.playerdataIF["PlayerChessData"] = data
		}
	}
	player.GetIFGameData("PlayerChessData").(*PlayerChessData).ResChessColorData(player)
}

func UpdateChessColorDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerChessData")
	data.(*PlayerChessData).UpdateChessColorData(buf)

}

func ReqPlayerGiftDataFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerGiftData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerGiftData") == nil {
		data := &PlayerGiftData{PlayerData: NewPlayerData("PlayerGiftData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerGiftData"] = data
			player.playerdataIF["PlayerGiftData"] = data
		}
	}
	player.GetIFGameData("PlayerGiftData").(*PlayerGiftData).ResPlayerGiftData(player)
}

func UpdatePlayerGiftDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerGiftData")
	data.(*PlayerGiftData).UpdatePlayerGiftData(buf)

}

func ReqPlayerOrderDataFunc(args []interface{}) {

	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqPlayerOrderData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerOrderData") == nil {
		data := &PlayerOrderData{PlayerData: NewPlayerData("PlayerOrderData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerOrderData"] = data
			player.playerdataIF["PlayerOrderData"] = data
		}
	}
	player.GetIFGameData("PlayerOrderData").(*PlayerOrderData).ResPlayerOrderData(player)
}

func ReqDecorateDatafunc(args []interface{}) {
	// 消息的发送者
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqDecorateData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerDecorateData") == nil {
		data := &PlayerDecorateData{PlayerData: NewPlayerData("PlayerDecorateData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerDecorateData"] = data
			player.playerdataIF["PlayerDecorateData"] = data
		}
	}
	player.GetIFGameData("PlayerDecorateData").(*PlayerDecorateData).ResDecorateData(player)
}

func UpdatePlayerOrderDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerOrderData")
	data.(*PlayerOrderData).UpdatePlayerOrderData(buf)
}

func UpdateDecorateDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerDecorateData")
	data.(*PlayerDecorateData).UpdateDecorateData(buf)
}

func ReqUnlockingChestIDFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerUnlockingChestData")
	G_getGameLogic().Mlogger.Debug("ReqUnlockingChestIDFunc:", data)
	data.(*PlayerUnlockingChestData).ResUnlockingChestID(buf)
}

func ReqChestUnlockCDFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerUnlockingChestData")
	data.(*PlayerUnlockingChestData).ResChestUnlockCD(buf)
}

func ReqEmitMergeMapFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).ResEmitMergeMap(buf)
}

func ReqResEmitCountMapFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).ResEmitCountMap(buf)
}

func ReqEmitCDStartDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).ResEmitCDStartData(buf)
}

func UpdateEmitMergeMapFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).UpdateEmitMergeMap(buf)
}

func ReqEmitSubCDFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).ReqEmitSubCD(buf)
}

func UpdateEmitCountMapFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmitDetaliData")
	data.(*PlayerEmitDetaliData).UpdateEmitCountMap(buf)
}
func ReqShopDatafunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqShopData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerShopData") == nil {
		data := &PlayerShopData{PlayerData: NewPlayerData("PlayerShopData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerShopData"] = data
			player.playerdataIF["PlayerShopData"] = data
		}
	}
	player.GetIFGameData("PlayerShopData").(*PlayerShopData).ResShopData(player)

}

func ReqShopBuyFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerShopData")
	data.(*PlayerShopData).ResShopBuy(buf)
}

func ReqRenewItemBuyCntFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerShopData")
	data.(*PlayerShopData).ResRenewItemBuyCnt(buf)
}

func ReqBriefEmailDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqBriefEmailData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerEmailData") == nil {
		data := &PlayerEmailData{PlayerData: NewPlayerData("PlayerEmailData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerEmailData"] = data
			player.playerdataIF["PlayerEmailData"] = data
		}
	}
	player.GetIFGameData("PlayerEmailData").(*PlayerEmailData).ResBriefEmailData()

}

func ReqDetailEmailDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmailData")
	data.(*PlayerEmailData).ResDetailEmailData(buf)
}

func ReqGetEmailRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmailData")
	data.(*PlayerEmailData).ResGetEmailReward(buf)
}

func ReqDeleteEmailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerEmailData")
	data.(*PlayerEmailData).ResDeleteEmail(buf)
}

func ReqGetLimitPassportRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerPassportData")
	data.(*PlayerPassportData).ResGetLimitPassportReward(buf)
}

func ReqBuyLimitPromotionRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerPromotionData")
	data.(*PlayerPromotionData).ResBuyLimitPromotionReward(buf)
}

func ReqBuyInfinitePackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	// data := player.GetIFGameData("PlayerInfinitePackData")
	// data.(*PlayerInfinitePackData).ResBuyInfinitePack(buf)

	player.GetIFGameData("PlayerNewInfinitePackData").(*PlayerNewInfinitePackData).ResBuyInfinitePack(buf)
}

func ReqPayPassportFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	data := player.GetIFGameData("PlayerPassportData")
	data.(*PlayerPassportData).ResPayPassport(buf)
}

func ReqActiveAddStarFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerPassportData")
	data.(*PlayerPassportData).ResActiveAddStar(buf)
}

func ReqLimitPassportDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("PlayerPassportData") == nil {
		actor := &PlayerPassportData{PlayerActiveData: NewActiveData("PlayerPassportData", player)}
		ok := actor.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPassportData"] = actor
			player.playerdataIF["PlayerPassportData"] = actor
		}
	} else {
		data := player.GetIFGameData("PlayerPassportData").(*PlayerPassportData)
		if data.MisDirty {
			data.ClearData()
			data.LoadDataFromDB(player.M_DwUin)
			data.MisDirty = false
		}
	}
	data := player.GetIFGameData("PlayerPassportData")
	data.(*PlayerPassportData).ResLimitPassportDetail(buf)
}

func ReqPromotionDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("PlayerPromotionData") == nil {
		actor := &PlayerPromotionData{PlayerActiveData: NewActiveData("PlayerPromotionData", player)}
		ok := actor.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPromotionData"] = actor
			player.playerdataIF["PlayerPromotionData"] = actor
		}
	} else {
		data := player.GetIFGameData("PlayerPromotionData").(*PlayerPromotionData)
		if data.MisDirty {
			data.ClearData()
			data.LoadDataFromDB(player.M_DwUin)
			data.MisDirty = false
		}
	}
	data := player.GetIFGameData("PlayerPromotionData")
	data.(*PlayerPromotionData).ResPromotionDetail(buf)
}

func ReqInfinitePackDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("PlayerNewInfinitePackData") == nil {
		data := &PlayerNewInfinitePackData{PlayerData: NewPlayerData("PlayerNewInfinitePackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerNewInfinitePackData"] = data
			player.playerdataIF["PlayerNewInfinitePackData"] = data
		}
	}

	player.GetIFGameData("PlayerNewInfinitePackData").(*PlayerNewInfinitePackData).ResInfinitePackDetail(buf)

	// if player.GetGameData("PlayerInfinitePackData") == nil {
	// 	actor := &PlayerInfinitePackData{PlayerActiveData: NewActiveData("PlayerInfinitePackData", player)}
	// 	ok := actor.LoadDataFromDB(player.M_DwUin)
	// 	if ok {
	// 		player.playerdata["PlayerInfinitePackData"] = actor
	// 		player.playerdataIF["PlayerInfinitePackData"] = actor
	// 	}
	// } else {
	// 	data := player.GetIFGameData("PlayerInfinitePackData").(*PlayerInfinitePackData)
	// 	if data.MisDirty {
	// 		data.ClearData()
	// 		data.LoadDataFromDB(player.M_DwUin)
	// 		data.MisDirty = false
	// 	}
	// }
	// data := player.GetIFGameData("PlayerInfinitePackData")
	// data.(*PlayerInfinitePackData).ResInfinitePackDetail(buf)
}

func ReqCardCollectDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("PlayerCardCollectData") == nil {
		actor := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := actor.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = actor
			player.playerdataIF["PlayerCardCollectData"] = actor
		}
	} else {
		data := player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData)
		if data.MisDirty {
			data.ClearData()
			data.LoadDataFromDB(player.M_DwUin)
			data.MisDirty = false
		}
	}
	data := player.GetIFGameData("PlayerCardCollectData")
	data.(*PlayerCardCollectData).ResCardCollectDetail(buf)
}

func ReqGetCardAlbumRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ResGetCardAlbumReward(buf)
}

func ReqGetAllCardRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ResGetAllCardReward(buf)
}

func ReqAddCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqAddCard(buf)
}

func ReqUnpackCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ResUnpackCard(buf)
}

func ReqBuyStickerItemFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqBuyStickerItem(buf)
}

func ReqAddMasterCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqAddMasterCard(buf)
}

func ReqUseMasterCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqUseMasterCard(buf)
}

// //////卡牌交换
func ReqExchangeCardBoxDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqExchangeCardBoxData(buf)
}
func ReqDonateFriendCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqDonateFriendCard(buf)
}

func ReqGetDonateCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqGetDonateCard(buf)
}

func ReqExchangeCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqExchangeCard(buf)
}

func ReqReceiptCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqReceiptCard(buf)
}

func ReqCompleteExchangeCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqCompleteExchangeCard(buf)
}

func ReqGetExchangeCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqGetExchangeCard(buf)
}

func ReqRefuseExchangeFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqRefuseExchange(buf)
}

func ReqRequestCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqRequestCard(buf)
}

func ReqCompleteRequestCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqCompleteRequestCard(buf)
}

func ReqRefuseRequestCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqRefuseRequestCard(buf)
}

func ReqGetRequestCardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerCardCollectData") == nil {
		data := &PlayerCardCollectData{PlayerActiveData: NewActiveData("PlayerCardCollectData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerCardCollectData"] = data
			player.playerdataIF["PlayerCardCollectData"] = data
		}
	}
	player.GetIFGameData("PlayerCardCollectData").(*PlayerCardCollectData).ReqGetRequestCard(buf)
}

/////////////////////

func Req7DayLoginDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("Player7DayLoginData") == nil {
		actor := &Player7DayLoginData{PlayerActiveData: NewActiveData("Player7DayLoginData", player)}
		ok := actor.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["Player7DayLoginData"] = actor
			player.playerdataIF["Player7DayLoginData"] = actor
		}
	} else {
		data := player.GetIFGameData("Player7DayLoginData").(*Player7DayLoginData)
		if data.MisDirty {
			data.ClearData()
			data.LoadDataFromDB(player.M_DwUin)
			data.MisDirty = false
		}
	}
	data := player.GetIFGameData("Player7DayLoginData")
	data.(*Player7DayLoginData).Res7DayLoginDetail(buf)
}

func ReqGet7DayLoginPackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("Player7DayLoginData") == nil {
		data := &Player7DayLoginData{PlayerActiveData: NewActiveData("Player7DayLoginData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["Player7DayLoginData"] = data
			player.playerdataIF["Player7DayLoginData"] = data
		}
	}
	player.GetIFGameData("Player7DayLoginData").(*Player7DayLoginData).ResGet7DayLoginPack(buf)

}

func Req7DaySignalFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("Player7DayData") == nil {
		data := &Player7DayData{PlayerData: NewPlayerData("Player7DayData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["Player7DayData"] = data
			player.playerdataIF["Player7DayData"] = data
		}
	}
	player.GetIFGameData("Player7DayData").(*Player7DayData).Res7DaySignal(buf)
}

func Req7DayCallbackSignal(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	if player.GetGameData("Player7DayCallBackData") == nil {
		data := &Player7DayCallBackData{PlayerData: NewPlayerData("Player7DayCallBackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["Player7DayCallBackData"] = data
			player.playerdataIF["Player7DayCallBackData"] = data
		}
	}
	player.GetIFGameData("Player7DayCallBackData").(*Player7DayCallBackData).Req7DayCallbackSignal(buf)
}

func ReqLevelUpPackInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]

	player := p.(*Player)
	if player.GetGameData("PlayerLevelUpPackData") == nil {
		data := &PlayerLevelUpPackData{PlayerData: NewPlayerData("PlayerLevelUpPackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerLevelUpPackData"] = data
			player.playerdataIF["PlayerLevelUpPackData"] = data
		}
	}
	player.GetIFGameData("PlayerLevelUpPackData").(*PlayerLevelUpPackData).ResLevelUpPackInfo(player)
}

func ReqBuyLevelUpPackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerLevelUpPackData")
	data.(*PlayerLevelUpPackData).ReqBuyLevelUpPack(buf)
}

func ReqGrowthFundInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]

	player := p.(*Player)
	if player.GetGameData("PlayerGrowthFundData") == nil {
		data := &PlayerGrowthFundData{PlayerData: NewPlayerData("PlayerGrowthFundData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerGrowthFundData"] = data
			player.playerdataIF["PlayerGrowthFundData"] = data
		}
	}
	player.GetIFGameData("PlayerGrowthFundData").(*PlayerGrowthFundData).ResGrowthFundInfo(player)
}

func ReqBuyGrowthFundFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerGrowthFundData")
	data.(*PlayerGrowthFundData).ReqBuyGrowthFund(buf)
}

func ReqGetGrowthFundWardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)
	data := player.GetIFGameData("PlayerGrowthFundData")
	data.(*PlayerGrowthFundData).ReqGetGrowthFundWard(buf)
}

func ReqOfflineReconnectFunc(args []interface{}) {
	a := args[0].(gate.Agent)

	buf := args[1].([]byte)

	req := &msg.ReqOfflineReconnect{}
	proto.Unmarshal(buf, req)

	res := &msg.ResOfflineReconnect{}
	res.DwUin = req.DwUin

	if player, ok := G_GameLogicPtr.M_Players[req.DwUin]; ok {
		agent := player.GetAgentByPlayer()
		if agent != a {
			internal.AsignPlayerToAgents(a, player)
			player.PAMgr.InitActiveMgr(player)
			delete(internal.Agents, agent)
		}

		res.Result = 3
	} else {
		player := G_GameLogicPtr.FindOfflinePlayer(req.DwUin)
		if player != nil {
			res.Result = 1
			G_GameLogicPtr.RebindPlayerAndAgent(a, player)
		} else {
			res.Result = 2
		}
	}

	data, _ := proto.Marshal(res)
	G_GameLogicPtr.PackResInfo(a, "ResOfflineReconnect", data)
}

func ReqOpenNewPigFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	// buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerPigData") == nil {
		data := &PlayerPigData{PlayerData: NewPlayerData("PlayerPigData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPigData"] = data
			player.playerdataIF["PlayerPigData"] = data
		}
	}
	player.GetIFGameData("PlayerPigData").(*PlayerPigData).ResOpenNewPig(player)

}

func ReqPigDetailInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	// buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerPigData") == nil {
		data := &PlayerPigData{PlayerData: NewPlayerData("PlayerPigData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPigData"] = data
			player.playerdataIF["PlayerPigData"] = data
		}
	}
	player.GetIFGameData("PlayerPigData").(*PlayerPigData).ResPigDetailInfo(player)

}

func UpdateFinishOrderDiamondFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerPigData") == nil {
		data := &PlayerPigData{PlayerData: NewPlayerData("PlayerPigData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPigData"] = data
			player.playerdataIF["PlayerPigData"] = data
		}
	}
	player.GetIFGameData("PlayerPigData").(*PlayerPigData).UpdateFinishOrderDiamond(buf)

}

func ReqGetPigRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerPigData") == nil {
		data := &PlayerPigData{PlayerData: NewPlayerData("PlayerPigData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPigData"] = data
			player.playerdataIF["PlayerPigData"] = data
		}
	}
	player.GetIFGameData("PlayerPigData").(*PlayerPigData).ResGetPigReward(buf)

}

func ReqDropPigRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerPigData") == nil {
		data := &PlayerPigData{PlayerData: NewPlayerData("PlayerPigData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPigData"] = data
			player.playerdataIF["PlayerPigData"] = data
		}
	}
	player.GetIFGameData("PlayerPigData").(*PlayerPigData).ResDropPigReward(buf)

}

func ReqSupremeGiftInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]

	player := p.(*Player)

	if player.GetGameData("PlayerSupermeGiftData") == nil {
		data := &PlayerSupermeGiftData{PlayerData: NewPlayerData("PlayerSupermeGiftData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSupermeGiftData"] = data
			player.playerdataIF["PlayerSupermeGiftData"] = data
		}
	}
	player.GetIFGameData("PlayerSupermeGiftData").(*PlayerSupermeGiftData).ResSupremeGiftInfo(player)
}

func ReqBuySupremeGiftFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	player.GetIFGameData("PlayerSupermeGiftData").(*PlayerSupermeGiftData).ReqBuySupremeGift(buf)
}

/////////////////////////

func ReqIllustratedInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	// buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerIllustrateData") == nil {
		data := &PlayerIllustrateData{PlayerData: NewPlayerData("PlayerIllustrateData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerIllustrateData"] = data
			player.playerdataIF["PlayerIllustrateData"] = data
		}
	}
	player.GetIFGameData("PlayerIllustrateData").(*PlayerIllustrateData).ResIllustratedInfo(player)

}

func ReqGetIllustrateItemRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerIllustrateData") == nil {
		data := &PlayerIllustrateData{PlayerData: NewPlayerData("PlayerIllustrateData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerIllustrateData"] = data
			player.playerdataIF["PlayerIllustrateData"] = data
		}
	}
	player.GetIFGameData("PlayerIllustrateData").(*PlayerIllustrateData).ReqGetIllustrateItemReward(buf)

}

func UpdateIllustrateItemFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerIllustrateData") == nil {
		data := &PlayerIllustrateData{PlayerData: NewPlayerData("PlayerIllustrateData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerIllustrateData"] = data
			player.playerdataIF["PlayerIllustrateData"] = data
		}
	}
	player.GetIFGameData("PlayerIllustrateData").(*PlayerIllustrateData).UpdateIllustrateItem(buf)

}

// //////////////////////
func ResDailyTaskDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ReqBriefEmailData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("ResMileStoneData") == nil {
		data := &PlayerDailyTaskData{PlayerData: NewPlayerData("PlayerDailyTaskData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerDailyTaskData"] = data
			player.playerdataIF["PlayerDailyTaskData"] = data
		}
	}
	player.GetIFGameData("PlayerDailyTaskData").(*PlayerDailyTaskData).ResDailyTaskData(player)
}

func UpdateDailyTaskDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerDailyTaskData") == nil {
		data := &PlayerDailyTaskData{PlayerData: NewPlayerData("PlayerDailyTaskData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerDailyTaskData"] = data
			player.playerdataIF["PlayerDailyTaskData"] = data
		}
	}
	player.GetIFGameData("PlayerDailyTaskData").(*PlayerDailyTaskData).UpdateDailyTaskData(buf)
}

func RenewDailyTaskDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerDailyTaskData") == nil {
		data := &PlayerDailyTaskData{PlayerData: NewPlayerData("PlayerDailyTaskData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerDailyTaskData"] = data
			player.playerdataIF["PlayerDailyTaskData"] = data
		}
	}
	player.GetIFGameData("PlayerDailyTaskData").(*PlayerDailyTaskData).RenewDailyTaskData(buf)
}

func RenewWeekyActiveDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerDailyTaskData") == nil {
		data := &PlayerDailyTaskData{PlayerData: NewPlayerData("PlayerDailyTaskData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerDailyTaskData"] = data
			player.playerdataIF["PlayerDailyTaskData"] = data
		}
	}
	player.GetIFGameData("PlayerDailyTaskData").(*PlayerDailyTaskData).RenewWeekyActiveData(buf)
}

// ///
// //////////////////////
func ResMileStoneDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	detail := &msg.ResMileStoneData{}
	proto.Unmarshal(buf, detail)

	if player.GetGameData("PlayerMilestoneData") == nil {
		data := &PlayerMilestoneData{PlayerData: NewPlayerData("PlayerMilestoneData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerMilestoneData"] = data
			player.playerdataIF["PlayerMilestoneData"] = data
		}
	}
	player.GetIFGameData("PlayerMilestoneData").(*PlayerMilestoneData).ResMileStoneData(player)
}

func UpdateMileStoneDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerMilestoneData") == nil {
		data := &PlayerMilestoneData{PlayerData: NewPlayerData("PlayerMilestoneData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerMilestoneData"] = data
			player.playerdataIF["PlayerMilestoneData"] = data
		}
	}
	player.GetIFGameData("PlayerMilestoneData").(*PlayerMilestoneData).UpdateMileStoneData(buf)
}

func RenewMileStoneDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerMilestoneData") == nil {
		data := &PlayerMilestoneData{PlayerData: NewPlayerData("PlayerMilestoneData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerMilestoneData"] = data
			player.playerdataIF["PlayerMilestoneData"] = data
		}
	}
	player.GetIFGameData("PlayerMilestoneData").(*PlayerMilestoneData).RenewMileStoneData(buf)
}

func ReqChampshipDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	G_GameLogicPtr.MChampshipsManager.ReqChampshipData(player, buf)
}

func ReqPlayerChampshipData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	G_GameLogicPtr.MChampshipsManager.ReqPlayerChampshipData(player, buf)
}
func ReqChampshipAddScoreFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	G_GameLogicPtr.MChampshipsManager.ReqChampshipAddScore(player, buf)
}

func ReqChampshipAddTimeFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	G_GameLogicPtr.MChampshipsManager.ReqChampshipAddTime(player, buf)
}

func ReqChampshipRewardFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	G_GameLogicPtr.MChampshipsManager.ReqChampshipReward(player, buf)
}

// //////////////
func ReqAdPackDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)

	if player.GetGameData("PlayerAdPackData") == nil {
		data := &PlayerAdPackData{PlayerData: NewPlayerData("PlayerAdPackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerAdPackData"] = data
			player.playerdataIF["PlayerAdPackData"] = data
		}
	}
	player.GetIFGameData("PlayerAdPackData").(*PlayerAdPackData).ReqAdPackData(player)
}

func ReqWatchAdPackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerAdPackData") == nil {
		data := &PlayerAdPackData{PlayerData: NewPlayerData("PlayerAdPackData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerAdPackData"] = data
			player.playerdataIF["PlayerAdPackData"] = data
		}
	}
	player.GetIFGameData("PlayerAdPackData").(*PlayerAdPackData).ReqWatchAdPack(buf)
}

/////////////

func ReqPlayerSingleDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)

	if player.GetGameData("PlayerSingleData") == nil {
		data := &PlayerSingleData{PlayerData: NewPlayerData("PlayerSingleData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSingleData"] = data
			player.playerdataIF["PlayerSingleData"] = data
		}
	}
	player.GetIFGameData("PlayerSingleData").(*PlayerSingleData).ReqPlayerSingleData(player)
}

func ReqOpenNewbiePackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerSingleData") == nil {
		data := &PlayerSingleData{PlayerData: NewPlayerData("PlayerSingleData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSingleData"] = data
			player.playerdataIF["PlayerSingleData"] = data
		}
	}
	player.GetIFGameData("PlayerSingleData").(*PlayerSingleData).ReqOpenNewbiePack(buf)
}

func ReqBuyNewbiePackFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerSingleData") == nil {
		data := &PlayerSingleData{PlayerData: NewPlayerData("PlayerSingleData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSingleData"] = data
			player.playerdataIF["PlayerSingleData"] = data
		}
	}
	player.GetIFGameData("PlayerSingleData").(*PlayerSingleData).ReqBuyNewbiePack(buf)
}

func ReqAddWatchAdCntFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerSingleData") == nil {
		data := &PlayerSingleData{PlayerData: NewPlayerData("PlayerSingleData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSingleData"] = data
			player.playerdataIF["PlayerSingleData"] = data
		}
	}
	player.GetIFGameData("PlayerSingleData").(*PlayerSingleData).ReqAddWatchAdCnt(buf)
}

func ReqAddNoAdCntFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerSingleData") == nil {
		data := &PlayerSingleData{PlayerData: NewPlayerData("PlayerSingleData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerSingleData"] = data
			player.playerdataIF["PlayerSingleData"] = data
		}
	}
	player.GetIFGameData("PlayerSingleData").(*PlayerSingleData).ReqAddNoAdCnt(buf)
}

// ////////////
func ReqPlayerPayDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)

	if player.GetGameData("PlayerChargeData") == nil {
		data := &PlayerChargeData{PlayerData: NewPlayerData("PlayerChargeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerChargeData"] = data
			player.playerdataIF["PlayerChargeData"] = data
		}
	}
	player.GetIFGameData("PlayerChargeData").(*PlayerChargeData).ReqPlayerPayData(player)
}

func ReqAddPayFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	buf := args[1].([]byte)
	player := p.(*Player)

	if player.GetGameData("PlayerChargeData") == nil {
		data := &PlayerChargeData{PlayerData: NewPlayerData("PlayerChargeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerChargeData"] = data
			player.playerdataIF["PlayerChargeData"] = data
		}
	}
	player.GetIFGameData("PlayerChargeData").(*PlayerChargeData).ReqAddPay(buf)
}

func ReqLimitDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	req := &msg.ReqLimitData{}
	proto.Unmarshal(buf, req)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(req.ID)

	var data PlayerDataModule
	if player.GetGameData(dataName) == nil {
		data = CreateLimiteEventData(req.ID, dataName, player)
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata[dataName] = data
			player.playerdataIF[dataName] = data
		}
	}
	// LimitDataMap[1] = "PlayerChestRainData"
	// LimitDataMap[2] = "PlayerSuperEmiterData"
	// LimitDataMap[3] = "PlayerStarRainData"
	// LimitDataMap[4] = "PlayerHighRollerData"
	// LimitDataMap[5] = "PlayerSuperOrderData"

	player.GetIFGameData(dataName).(PlayerLimitDataModule).ResLimitData(player)
	// if req.ID == 1 {
	// 	player.GetIFGameData(dataName).(*PlayerChestRainData).ResLimitData(player)
	// }
	// if req.ID == 2 {
	// 	player.GetIFGameData(dataName).(*PlayerSuperEmiterData).ResLimitData(player)
	// }
	// if req.ID == 3 {
	// 	player.GetIFGameData(dataName).(*PlayerStarRainData).ResLimitData(player)
	// }
	// if req.ID == 4 {
	// 	player.GetIFGameData(dataName).(*PlayerHighRollerData).ResLimitData(player)
	// }
	// if req.ID == 5 {
	// 	player.GetIFGameData(dataName).(*PlayerSuperOrderData).ResLimitData(player)
	// }
	// if req.ID == 6 {
	// 	player.GetIFGameData(dataName).(*PlayerSceneSprintData).ResLimitData(player)
	// }
}

func ReqAddLimitTimeFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	req := &msg.ReqAddLimitTime{}
	proto.Unmarshal(buf, req)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(req.ID)

	var data PlayerDataModule
	if player.GetGameData(dataName) == nil {
		data = CreateLimiteEventData(req.ID, dataName, player)
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata[dataName] = data
			player.playerdataIF[dataName] = data
		}
	}
	// LimitDataMap[1] = "PlayerChestRainData"
	// LimitDataMap[2] = "PlayerSuperEmiterData"
	// LimitDataMap[3] = "PlayerStarRainData"
	// LimitDataMap[4] = "PlayerHighRollerData"
	// LimitDataMap[5] = "PlayerSuperOrderData"
	player.GetIFGameData(dataName).(PlayerLimitDataModule).ResAddLimitTime(buf)
	// if req.ID == 1 {
	// 	player.GetIFGameData(dataName).(*PlayerChestRainData).ResAddLimitTime(buf)
	// }
	// if req.ID == 2 {
	// 	player.GetIFGameData(dataName).(*PlayerSuperEmiterData).ResAddLimitTime(buf)
	// }
	// if req.ID == 3 {
	// 	player.GetIFGameData(dataName).(*PlayerStarRainData).ResAddLimitTime(buf)
	// }
	// if req.ID == 4 {
	// 	player.GetIFGameData(dataName).(*PlayerHighRollerData).ResAddLimitTime(buf)
	// }
	// if req.ID == 5 {
	// 	player.GetIFGameData(dataName).(*PlayerSuperOrderData).ResAddLimitTime(buf)
	// }
	// if req.ID == 6 {
	// 	player.GetIFGameData(dataName).(*PlayerSceneSprintData).ResAddLimitTime(buf)
	// }
}
func ReqGenSuperOrderFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(5)
	player.GetIFGameData(dataName).(*PlayerSuperOrderData).ResGenSuperOrder(buf)

}

func ReqEndSuperOrder(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(5)
	player.GetIFGameData(dataName).(*PlayerSuperOrderData).ReqEndSuperOrder(buf)

}

func ReqCompleteDoubleHit(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(8)
	player.GetIFGameData(dataName).(*PlayerDoubleHitData).ReqCompleteDoubleHit(buf)

}

func ReqTagThief(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	dataName := G_GameLogicPtr.MLimiteEventManager.GetLimitDataNameById(10)
	player.GetIFGameData(dataName).(*PlayerPetRobberData).ReqTagThief(buf)

}

// ////////////
func ReqFriendDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	// buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqFriendData(player)
}

func ReqWillPlayerDetailFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqWillPlayerDetail(buf)
}

func ReqAddFriendDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqAddFriendData(buf)
}

func ReqAllAddFriendInfoFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqAllAddFriendInfo(buf)
}

func ReqAgreeFriendReqFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqAgreeFriendReq(buf)
}

func ReqAutoFBAddFriend(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqAutoFBAddFriend(buf)
}

func ReqAutoAddInviteFriend(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqAutoAddInviteFriend(buf)
}

func ReqFriendTreasureData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqFriendTreasureData(buf)
}

func ReqUpdateFriendStar(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqUpdateFriendStar(buf)
}

func ReqRecommendFriendList(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqRecommendFriendList(buf)
}

func ReqRefuseFriendReqFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqRefuseFriendReq(buf)
}

func ReqDeleteFriendFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqDeleteFriend(buf)
}

func ReqInviteFriendData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqInviteFriendData(buf)
}

func ReqSelfInvited(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqSelfInvited(buf)
}

func ReqGetInviteReward(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendData") == nil {
		data := &PlayerFriendData{PlayerData: NewPlayerData("PlayerFriendData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendData"] = data
			player.playerdataIF["PlayerFriendData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendData").(*PlayerFriendData).ReqGetInviteReward(buf)
}

func ReqPlayerProfileDataFunc(args []interface{}) {
	G_GameLogicPtr.MPlayerProfileManager.ReqPlayerProfileData(args)
}

func ReqUpdatePlayerProfileFunc(args []interface{}) {
	G_GameLogicPtr.MPlayerProfileManager.ReqUpdatePlayerProfile(args)
}

func ReqPlayerBriefProfileDataFunc(args []interface{}) {
	G_GameLogicPtr.MPlayerProfileManager.ReqPlayerBriefProfileData(args)
}

func ReqUpdateFBPicURLFunc(args []interface{}) {
	G_GameLogicPtr.MPlayerProfileManager.ReqUpdateFBPicURL(args)
}

func ReqFriendEventDataFunc(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerFriendEventData") == nil {
		data := &PlayerFriendEventData{PlayerData: NewPlayerData("PlayerFriendEventData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerFriendEventData"] = data
			player.playerdataIF["PlayerFriendEventData"] = data
		}
	}
	player.GetIFGameData("PlayerFriendEventData").(*PlayerFriendEventData).ReqFriendEventData(buf)
}

func ReqBindFacebookAccount(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerBaseData") == nil {
		data := &PlayerBaseData{PlayerData: NewPlayerData("PlayerBaseData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerBaseData"] = data
			player.playerdataIF["PlayerBaseData"] = data
		}
	}
	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ReqBindFacebookAccount(buf)
}

func ReqUnBindFacebook(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerBaseData") == nil {
		data := &PlayerBaseData{PlayerData: NewPlayerData("PlayerBaseData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerBaseData"] = data
			player.playerdataIF["PlayerBaseData"] = data
		}
	}
	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ReqUnBindFacebook(buf)
}

func ReqOnlyBindFacebook(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerBaseData") == nil {
		data := &PlayerBaseData{PlayerData: NewPlayerData("PlayerBaseData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerBaseData"] = data
			player.playerdataIF["PlayerBaseData"] = data
		}
	}
	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ReqOnlyBindFacebook(buf)
}

func ReqSynGameData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerBaseData") == nil {
		data := &PlayerBaseData{PlayerData: NewPlayerData("PlayerBaseData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerBaseData"] = data
			player.playerdataIF["PlayerBaseData"] = data
		}
	}
	player.GetIFGameData("PlayerBaseData").(*PlayerBaseData).ReqSynGameData(buf)
}

func ReqPlayerPetData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	// buf := args[1].([]byte)

	if player.GetGameData("PlayerPetData") == nil {
		data := &PlayerPetData{PlayerData: NewPlayerData("PlayerPetData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetData"] = data
			player.playerdataIF["PlayerPetData"] = data
		}
	}
	player.GetIFGameData("PlayerPetData").(*PlayerPetData).ReqPlayerPetData(player)
}

func ReqUpdatePetProfile(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetData") == nil {
		data := &PlayerPetData{PlayerData: NewPlayerData("PlayerPetData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetData"] = data
			player.playerdataIF["PlayerPetData"] = data
		}
	}
	player.GetIFGameData("PlayerPetData").(*PlayerPetData).ReqUpdatePetProfile(buf)
}

//////////////

func ReqPetHomeData(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	// buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqPetHomeData(player)
}

func ReqOpenOtherPetHome(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqOpenOtherPetHome(buf)
}

func ReqUnlockDecorate(args []interface{}) {
	a := args[0].(gate.Agent)
	p := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqUnlockDecorate(buf)
}

func ReqSaveSelectDecorate(args []interface{}) {
	a := args[0].(gate.Agent)
	p := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqSaveSelectDecorate(buf)
}
func ReqCompleteMiniGame(args []interface{}) {
	a := args[0].(gate.Agent)
	p := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqCompleteMiniGame(buf)
}

func ReqOpenSelfPet(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqOpenSelfPet(buf)
}

func ReqPetHomeInterActST(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqPetHomeInterActST(buf)
}

func ReqShiftVisitPet(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqShiftVisitPet(buf)
}

func ReqCallBackPet(args []interface{}) {
	a := args[0].(gate.Agent)
	p, _ := internal.Agents[a]
	player := p.(*Player)
	buf := args[1].([]byte)

	if player.GetGameData("PlayerPetHomeData") == nil {
		data := &PlayerPetHomeData{PlayerData: NewPlayerData("PlayerPetHomeData", player)}
		ok := data.LoadDataFromDB(player.M_DwUin)
		if ok {
			player.playerdata["PlayerPetHomeData"] = data
			player.playerdataIF["PlayerPetHomeData"] = data
		}
	}
	player.GetIFGameData("PlayerPetHomeData").(*PlayerPetHomeData).ReqCallBackPet(buf)
}
